|
|
|
|
|
|
|
'
' is this the default user account?
If lblUserID = "DEFAULT" Then
strObject = InputBox("Enter new secure object:", "Create new Object")
strObject = UCase(Trim(strObject))
Else
strObject = dtaDefault.Recordset!object
End If
'
' try to add it to the collection
If strObject <> "" Then
With dtaUserID.Recordset
.FindFirst "UserID='" & lblUserID & "' AND object='" & strObject &
"'"
If .NoMatch = True Then
.AddNew
.UserID = lblUserID
!object = strObject
![Level] = 0
.Update
Else
MsgBox "Object Already on File", vbExclamation, "Add Object"
End If
End With
End If
'
accLoadLists
'
Exit Sub
'
LocalErr:
MsgBox Err.Description, vbExclamation, Err.Number
'
End Sub |
|
|
|
|
|
|
|
|
This routine gets some variables from the form and then checks to see whether you are trying to add an object to the Default user. If so, you are prompted for the new object name, and if a valid one is entered, that object is added to the Default list. If you are attempting to add a new object to a real user, the routine checks to make sure the object does not already exist for that user before adding it to your list. |
|
|
|
|
|
|
|
|
The next routine to add (shown in Listing 21.25) deletes an object from the User List. Create a new subroutine called accDelObject and add the code in Listing 21.25. |
|
|
|
|
|
|
|
|
Listing 21.25. Deleting an object with accDelObject. |
|
|
|
|
|
|
|
|
Public Sub accDelObject()
'
' delete an object from the User list
'
Dim strObject As String |
|
|
|
|
|